home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 2000 April: Mac OS SDK / Dev.CD Apr 00 SDK1.toast / Development Kits / Mac OS / Navigation Services SDK / Examples / SimpleText / SimpleText ƒ / MacIncludes.h < prev    next >
Encoding:
C/C++ Source or Header  |  1999-06-16  |  4.5 KB  |  159 lines  |  [TEXT/MPS ]

  1. /*
  2.     File:        MacIncludes.h
  3.  
  4.     Copyright:    © 1998 by Apple Computer, Inc., all rights reserved.
  5.  
  6. */
  7.  
  8. /*
  9. **    You may incorporate this sample code into your applications without
  10. **    restriction, though the sample code has been provided "AS IS" and the
  11. **    responsibility for its operation is 100% yours.  However, what you are
  12. **    not permitted to do is to redistribute the source as "DSC Sample Code"
  13. **    after having made changes. If you're going to re-distribute the source,
  14. **    we require that you make it clear in the source that the code was
  15. **    descended from Apple Sample Code, but that you've made changes.
  16. */
  17.  
  18.  
  19. #ifndef __MACINCLUDES__
  20. #define __MACINCLUDES__
  21.  
  22. #define SystemSevenOrLater                    1
  23. #define    BUILDING_FOR_SYSTEM7_AND_SYSTEM8    1
  24. #define OLDROUTINENAMES                        1
  25.  
  26. #include <StdArg.h>
  27. #include <Limits.h>
  28. #include <Types.h>
  29. #include <Resources.h>
  30. #include <QuickDraw.h>
  31. #include <Fonts.h>
  32. #include <Events.h>
  33. #include <Windows.h>
  34. #include <Menus.h>
  35. #include <TextEdit.h>
  36. #include <Dialogs.h>
  37. #include <ToolUtils.h>
  38. #include <Memory.h>
  39. #include <SegLoad.h>
  40. #include <Files.h>
  41. #include <OSUtils.h>
  42. #include <Traps.h>    
  43. #include <Script.h>
  44. #include <ColorPicker.h>
  45. #include <FixMath.h>
  46. #include <Packages.h>
  47. #include <Math.h>
  48. #include <Palettes.h>
  49. #include <QDOffscreen.h>
  50. #include <DeskBus.h>
  51. #include <StdLib.h>
  52. #include <StdArg.h>
  53. #include <Strings.h>
  54. #include <StdIO.h>
  55. #include <Sound.h>
  56. #include <Errors.h>
  57. #include <AppleEvents.h>
  58. #include <DiskInit.h>
  59. #include <Retrace.h>
  60. #include <Folders.h>
  61. #include <Lists.h>
  62. #include <CTBUtilities.h>
  63. #include <Gestalt.h>
  64. #include <Finder.h>
  65. #include <Scrap.h>
  66. #include <Devices.h>
  67. #include <Video.h>
  68. #include <Aliases.h>
  69. #include <SoundInput.h>
  70. #include <Movies.h>
  71. #include <Printing.h>
  72. #include <Balloons.h>
  73. #include <MixedMode.h>
  74. #include <Drag.h>
  75. #include <TSMTE.h>
  76. #include <AppleGuide.h>
  77. #include <Speech.h>
  78. #include <Icons.h>
  79. #include <LowMem.h>
  80. #include <GXMath.h>
  81. #include <GXGraphics.h>
  82. #include <GXEnvironment.h>
  83. #include <GXFonts.h>
  84. #include <GXLayout.h>
  85. #include <GXPrinting.h>
  86. #include <GXMessages.h>
  87. #include <CodeFragments.h>
  88. #include <TextUtils.h>
  89.  
  90. // ----- BEGINNING OF SWIPED MACROS -----
  91.  
  92. #define GetDialogKeyboardFocusItem(dialog) ((*(SInt16 *) (((UInt8 *) dialog) + 164)) < 0 ? -1 : (*(SInt16 *) (((UInt8 *) dialog) + 164)) + 1)
  93.  
  94. // ----- END OF SWIPED MACROS -----
  95.  
  96. // Balloons.h
  97. #define kDefaultBalloonVariant    2
  98.  
  99. // Fonts.h
  100. #if !GENERATINGPOWERPC
  101.     pascal short GetDefFontSize(void)
  102.     = {0x3EB8,0x0BA8,0x6604,0x3EBC,0x000C};
  103. #endif
  104.  
  105. // GXPrinterDrivers.h
  106. #if GENERATINGPOWERPC
  107.     // in the old library, these are not automagically remapped from the
  108.     // forward messages, so we do so via Macros.  At some point, can remove
  109.     // this once SCM libs catch up.
  110.     #undef Forward_GXPrintingEvent
  111.     #undef Forward_GXCompleteSpoolFile
  112.     #undef Send_GXSpoolResource
  113.     
  114. // Jason Yeo: the follwoing 3 functions used to be extern Psacal OSErr ....
  115.     extern OSErr Forward_GXPrintingEvent(EventRecord *evtRecord, Boolean filterEvent);
  116.     extern OSErr Forward_GXCompleteSpoolFile(gxSpoolFile theSpoolFile);    
  117.     extern OSErr Send_GXSpoolResource(gxSpoolFile theSpoolFile, Handle theResource, ResType theType, long id);    
  118. #endif
  119.  
  120. // For looking at all of our windows, not just the visible ones.
  121. #define    LMGetFirstWindow() (* (WindowRef*) 0x9D6)
  122.  
  123. // No glue for this either, sigh.
  124. #define TESetClickLoop(L,H) ((**(H)).clickLoop = (L))
  125.  
  126. // defines I like to use all of the time
  127. extern void _DataInit();        // part of Runtime library
  128.  
  129. #define TopLeft(aRect)    (* (Point *) &(aRect).top)
  130. #define BotRight(aRect)    (* (Point *) &(aRect).bottom)
  131.  
  132. #define RectWidth(aRect) ((aRect).right - (aRect).left)
  133. #define RectHeight(aRect) ((aRect).bottom - (aRect).top)
  134.  
  135. #define Max(X, Y) ( ((X)>(Y)) ? (X) : (Y) )
  136. #define Min(X, Y) (  ((X)>(Y)) ? (Y) : (X) )
  137.  
  138. #define Pin(VALUE, MIN, MAX) ( ((VALUE) < (MIN)) ? (MIN) : ( ((VALUE) > (MAX)) ? (MAX) : (VALUE) ) )
  139.  
  140. #define nrequire(CONDITION, LABEL) if (true) {if ((CONDITION)) goto LABEL; }
  141. #define require(CONDITION, LABEL) if (true) {if (!(CONDITION)) goto LABEL; }
  142.  
  143. // The Pascal equivalent of strcpy, takes two Pascal string pointers
  144. #define PSTRCPY(P1, P2)    BlockMove(P2, P1, P2[0]+1)
  145.  
  146. // Concatante one character C onto the string S 
  147. #define CHARCAT(S, C)    S[(S[0]+1)] = C; S[0]++;
  148.  
  149. /* The Pascal equivalent of strcat, takes two Pascal string pointers */
  150. #define PSTRCAT(P1, P2)                         \
  151.     BlockMove(&P2[1], &P1[(P1[0]+1)], P2[0]);    \
  152.     P1[0] += P2[0];
  153.  
  154. #if defined(UNIVERSAL_INTERFACES_VERSION) && (UNIVERSAL_INTERFACES_VERSION < 0x300)
  155. #define CheckMenuItem(menu, item, checked) CheckItem(menu, item, checked)
  156. #endif
  157.  
  158. #endif /* __MACINCLUDES__ */
  159.